from django.urls import path, re_path
from apps.users import views

# Desktop/meiduo_shopping/meiduo_sp/meiduo_sp/urls.py

urlpatterns = [

    # ==>验证用户名http://www.meiduo.site:8080/usernames/wqwqw/count/
    path('usernames/<str:usernames>/count/', views.UsernameCountView.as_view()),

    # ==>验证用户手机号 mobiles/15839780192/count/
    path('mobiles/<str:mobile>/count/', views.MobileCountView.as_view()),

    # ==> 实现注册 http://www.meiduo.site:8000/register/,
    path('register/', views.RegisterView.as_view()),

    # ==> 实现登录 http://www.meiduo.site:8080/login.html
    path('login/', views.LoginView.as_view()),

    # ==> 退出登录 DELETE http: // www.meiduo.site: 8000 / logout /
    path('logout/', views.LogoutView.as_view()),

    # ==> 用户中心 "GET /info/ HTTP/1.1"
    path('info/', views.UserInfoView.as_view()),

    # ==>保存邮箱 PUT http://www.meiduo.site:8000/emails/
    path('emails/', views.UserEmailView.as_view()),

    # ==>激活请求 PUT http://www.meiduo.site:8000/emails/verification/
    path('emails/verification/', views.ActivateEmailView.as_view()),

    # ==> 修改密码 PUT http://www.meiduo.site:8000/password/
    path('password/', views.UpdatePasswordView.as_view()),

    # 新增保存收货地址 POST http://www.meiduo.site:8000/addresses/create/
    path('addresses/create/', views.AddAddressView.as_view()),

    # 删除地址和编辑地址 DELETE http://www.meiduo.site:8000/addresses/3/
    path('addresses/<int:id>/', views.UpdateAddressView.as_view()),

    # #更改标题"PUT http://www.meiduo.site:8000/addresses/29/title/
    path('addresses/<int:id>/title/', views.UpdateTitleView.as_view()),

    # 显示收货地址 GET http://www.meiduo.site:8000/addresses/
    path('addresses/', views.UserAddressView.as_view()),

    # #   修改默认地址 PUT http://www.meiduo.site:8000/addresses/29/default/
    re_path(r'^addresses/(?P<id>\d+)/default/$', views.UpdateDefaultAdsView.as_view()),

    # POST == > 请求地址browse_histories /
    path('browse_histories/', views.UserBrowseView.as_view()),

]
